package com.cc.bsp.persistence.entity;

import org.springframework.util.Assert;

import com.cc.bsp.persistence.IOrder;
import com.cc.bsp.persistence.IPage;
import com.cc.bsp.persistence.IQueryPageOrder;

public class QueryPageOrder implements IQueryPageOrder,IEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3698836616461942670L;


	public QueryPageOrder(IOrder order, IPage page) {
		super();
		Assert.notNull(order);
		Assert.notNull(page);
		this.order = order;
		this.page = page;
	}

	public IPage createPage(long total) {

		if (getPage() == null) {
			page = new BasicPageEntity(total);
		}else{
			page.setTotalcount(total);
		}
		
		setPage(page);
		
		page.page();

		return page;
	}

	private IOrder order;

	private IPage page;

	public IOrder getOrder() {
		return order;
	}

	public void setOrder(IOrder order) {
		this.order = order;
	}

	public IPage getPage() {
		return page;
	}

	public void setPage(IPage page) {
		this.page = page;
	}

}
